package org.truenewx.tnxjee.core.config;

import java.util.function.BiConsumer;

import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.truenewx.tnxjee.core.util.SpringUtil;

/**
 * 环境属性迭代器
 */
public class EnvironmentPropertiesIterator implements EnvironmentAware {

    private BiConsumer<String, Object> consumer;

    public EnvironmentPropertiesIterator(BiConsumer<String, Object> consumer) {
        this.consumer = consumer;
    }

    @Override
    public void setEnvironment(Environment environment) {
        SpringUtil.loopProperties(environment, this.consumer);
    }

}
